#ifndef TIM_ALGORITHM_H
#define TIM_ALGORITHM_H
#include "tim_bintree.h"

namespace tim
{
	template<typename T>
	void swap(T& a, T& b)
	{
		T temp;

		temp = a;
		a = b;
		b = temp;
	}

	template<typename T>
	void quick_sort(T* begin, T* end)
	{
		
	}

	/*void bracket2bintree(tim::bintree<char>& now, const char* punct)
	{
		tim::stack<tim::binnode<char>*> wait;
		tim::binnode<char>* temp = NULL;
		bool isleft = false;

		for (int i = 0; punct[i] != '\0'; i++) {
			tim::binnode<char>* node = new tim::binnode<char>(punct[i]);

			switch (punct[i]) {
				case '(':
					isleft = true;
					break;
				case ',':
					isleft = false;
					if (punct[i - 1] != '(') wait.pop();
					break;
				case ')':
					isleft = false;
					wait.pop();
					break;
				default:
					if (now.is_empty())
						wait.push(now.insert_root(punct[i]));
					else if (isleft)
						wait.push(now.insert_left_child(wait.top(), punct[i]));
					else
						wait.push(now.insert_right_child(wait.top(), punct[i]));
					break;
			}
		}

		return;
	}*/
}

#endif
